<template>
<!--  新增编辑产品说明-->
  <div>
    <div class="padding15 minMaxWidth600 marginAuto">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
        <el-form-item label="文档名称" prop="name">
          <el-input :disabled="disabled" class="width100" v-model="ruleForm.name" placeholder="请输入产品名称"></el-input>
        </el-form-item>
       
        <el-form-item label="说明地址" prop="phone">
          <el-input :disabled="disabled" class="width100" v-model="ruleForm.phone" placeholder="请输入产品货号"></el-input>
        </el-form-item>
        <el-form-item label="说明文档" prop="phone">
          <el-upload
              class="upload-demo"
              :action="actionUrl"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :on-exceed="handleExceed"
              :file-list="fileList">
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
        </el-form-item>
   
        <el-form-item>
          <el-button type="primary" :loading="isLoading" :submitDisbled="submitDisbled" @click="submitForm('ruleForm')">确定</el-button>
        </el-form-item>
      </el-form>
      <div class="padding15">
      <el-table
              :data="lists"
              height="580"
              stripe
              border
              ref="multipleTable"
              style="width: 100%">
              <el-table-column align="center" type="index" label="序号" width="50" />
        <el-table-column sortable align="center" prop="organizationName" label="产品名称" min-width="160"/>
  
        <el-table-column label="操作" align="center" width="160" fixed="right">
          <template slot-scope="scope">
            <el-button size="mini"  type="primary" @click="edit(scope.row)">编辑</el-button>
            <el-button size="mini"  type="danger" @click=" handledel(scope.row)">删除</el-button> 
            </el-dropdown>
         
          </template>
        </el-table-column>
      </el-table>
    </div>
    </div>
  </div>
</template>
<script>
//  import {} from '@/assets/api/api'
import {AddEditmixin} from '@/assets/mixins/addEditmixin'
  export default {
    name:'AddEditProduct',
    mixins: [AddEditmixin],
    components:{
      UploadImg:()=>import('@/components/uploadImg.vue'),
      TEditor:()=>import('@/components/TEditor.vue'),
    },
    data(){
      return{
        actionUrl:'',
        fileList:[{name:'1',url:''}],
        lists:[1],
          isLoading:false,
        submitDisbled:false,
  
        ruleForm:{
          content:"1",
          name: "",
          phone: "",
  
          expireDate:new Date().getTime(),
          roleId:'',
        
        },
        disabled:false,
        rules: {
          name: [
            { required: true, message: '请输入账号名', trigger: 'blur' },
            { min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' },
          ],
          phone: [
            { required: true, message: '请输入手机号', trigger: 'blur' },
            { min: 11, max: 11, message: '请输入正确手机号', trigger: 'blur' },
          ],
          roleId: [
            { required: true, message: '请选择会员等级', trigger: 'change' },
          ]
        },
        products:[],
        organizations:[],
        roles:[],
      }
    },
    created() {
     
        
      },
    methods:{
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      },
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
      },
      beforeRemove(file, fileList) {
        return this.$confirm(`确定移除 ${ file.name }？`);
      },
      handledel(){//删除

      },
      edit(){//编辑

      },
  
     
      submitForm(formName) {
        let that = this;
        that.isLoading = true;
      
        this.$refs[formName].validate((valid) => {
          if (valid) {
        
            that.isLoading = false;
          } else {
            that.isLoading = false;
            return false;
          }
        });
      },
    }
  }
</script>
<style lang="scss" scoped>
   ::v-deep .el-upload--text{
     width: 100%;
     display: flex;
     align-items: center;
     justify-content: center;
   }
</style>
